angular.module('signin',[])
.config(['$routeProvider',function($routeProvider){
	$routeProvider
	.when('/signin',{
		templateUrl:'html/signin/signin.html',
		css:'html/signin/signin.css'
	})
}])
.controller('signinCtrl',function($scope,$rootScope){
	//头部和底部显示隐藏
	$rootScope.sh = false;
	//注册
	$scope.sign = function(){
		var nn=document.getElementsByClassName("sign-input")[0].value;
		var nn2=document.getElementsByClassName("sign-input2")[0].value;
	 	var ajax= new XMLHttpRequest();
		ajax.open('POST','http://www.yanhanbo.top/user/sign.php');
		ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		ajax.send('username='+nn+'&password='+nn2);
		ajax.onreadystatechange = function(){
			if(ajax.status == 200 && ajax.readyState == 4){
				var obj = JSON.parse(ajax.responseText);
				if(obj.code ==1){
					alert(obj.msg);
					localStorage.na = nn;
					$rootScope.val = localStorage.na;
				}else{
					alert(obj.msg);
				}
			}
		}
	}
	
})